//
//  FANVisitorController.swift
//  Weibo - Swift
//
//  Created by user on 16/4/16.
//  Copyright © 2016年 user. All rights reserved.
//

import UIKit

class FANVisitorController: UITableViewController,FANVisitorViewDelegate {
    
    var isLogin:Bool = FANUserNetModel.sharedUserModel.isLogin
    
    override func loadView() {
        
        if isLogin{
            
            super.loadView()
        }else{
            
            view = visitorView
            
            navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: "didLoginButton")
            
            navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "didRegisterButton")
        }
        
    }
    
    func didRegisterButton(){
        
        print("点击了注册按钮")
    }
    
    func didLoginButton(){
        
        print("点击了登录按钮")
        
        let FANOAuthVc = FANOAuthViewController()
        
        self.presentViewController(UINavigationController(rootViewController: FANOAuthVc), animated: true, completion: nil)
    }
    
    
    lazy var visitorView:FANVisitorView = {
    
        let visitorView = FANVisitorView()
        
        visitorView.delegate = self
        
        return visitorView
    
    }()
        

}
